package com.tanhua.model.vo;

import com.tanhua.model.domain.QuestionOption;
import com.tanhua.model.domain.SoulList;
import com.tanhua.model.domain.SoulQuestion;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.List;

/**
 * @author げっしょく
 * @date 2021/11/8
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
public class SoulListVo {

    private String id;
    private String name;
    private String cover;
    private String level;
    private String star;
    private List<SoulQuestionVo> questions;
    private Integer isLock;
    private String reportId;

    public static SoulListVo init(SoulList soulList, List<SoulQuestionVo> questions, String reportId) {
        SoulListVo soulListVo = new SoulListVo();
        if (soulList != null) {
            BeanUtils.copyProperties(soulList, soulListVo);
            soulListVo.setId(soulList.getId().toString());
            soulListVo.setStar(soulList.getStar().toString());
            soulListVo.setQuestions(questions);
            soulListVo.setReportId(reportId);
        }
        return soulListVo;
    }
}
